home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / basic / mildred / mildred.lha / lha / SplitTests.lha / SpeedTest2.ascii < prev    next >
Text File  |  2000-02-23  |  4KB  |  162 lines

  1. WBStartup
  2.  
  3. #Objects=14
  4. MReserveShapes #Objects+1
  5.  
  6. .init
  7. InitBank 0,1280*512,$10000
  8. CludgeBitMap 0,1280,512,8,Bank(0)
  9. InitPalette 0,256
  10. LoadBitMap 0,"Pic.128",0
  11. MBitmap 0,1280,960
  12. MBitmapWindow 0,1,0,960-512,1280,512
  13. MPlanar16ToBitmap 1,Bank(0),1280,512,1280,512
  14. MBitmap 2,1280,960
  15. MBlockScroll 0,0,1280,960,0,0,0 ; Make backup
  16. InitBank 0,320*240,$10002
  17. CludgeBitMap 0,320,240,8,Bank(0)
  18. InitBank 1,320*240,$10002
  19. CludgeBitMap 1,320,240,8,Bank(1)
  20. Screen 0,0,0,320,240,8,0,"Game",0,0,0
  21. ShowPalette 0
  22.  
  23. .offsets
  24. MBitmap 1,320,240
  25. NEWTYPE.OffsetList
  26.   LineWidth.w
  27.   X1Offset.w
  28.   X2Offset.w
  29.   SourceModuloOffset.w
  30. End NEWTYPE
  31. Dim leftrows1.OffsetList(40)
  32. Dim leftrows2.OffsetList(40)
  33. Dim rightrows1.OffsetList(40)
  34. Dim rightrows2.OffsetList(40)
  35. leftrows1(0)\LineWidth=64-24,0,0,0
  36. leftrows2(0)\LineWidth=64,0,0,0
  37. rightrows1(0)\LineWidth=1,0,0,0
  38. rightrows2(0)\LineWidth=24,0,0,0
  39. For y=1 To 39
  40.   leftrows1(y)\LineWidth=64-24-y
  41.   leftrows1(y)\X1Offset=0
  42.   leftrows1(y)\X2Offset=0
  43.   leftrows1(y)\SourceModuloOffset=0
  44.   leftrows2(y)\LineWidth=64-y
  45.   leftrows2(y)\X1Offset=0
  46.   leftrows2(y)\X2Offset=0
  47.   leftrows2(y)\SourceModuloOffset=0
  48.   rightrows1(y)\LineWidth=y+1
  49.   rightrows1(y)\X1Offset=-1
  50.   rightrows1(y)\X2Offset=-1
  51.   rightrows1(y)\SourceModuloOffset=0
  52.   rightrows2(y)\LineWidth=24+y
  53.   rightrows2(y)\X1Offset=-1
  54.   rightrows2(y)\X2Offset=-1
  55.   rightrows2(y)\SourceModuloOffset=0
  56. Next
  57.  
  58. .setup
  59. Mc2pWindow 0,224,80,1280,320,240
  60. Mc2pWindow 1,96,80,1280,320,240
  61. Mc2pWindow 2,96,80,320,320,240
  62. Mc2pWindow 3,128,80,320,320,240
  63. Mc2pWindow 4,64,40,1280,320,240
  64. Mc2pWindow 5,64,40,320,320,240
  65. mousemult.q=1070/320
  66. its.l=0
  67. buf.b=0
  68. Mc2p 1,MBitmapPtr(0,700,0),MGenericPtr(224 LSR 3,0,Bank(0),40)
  69. Mc2p 1,MBitmapPtr(0,700,0),MGenericPtr(224 LSR 3,0,Bank(1),40)
  70. MZoom 0,0,12,12,0,160,96,80,False,0
  71. Mc2p 2,MBitmapPtr(0,160,1),MGenericPtr(0,160,Bank(0),40)
  72. Mc2p 2,MBitmapPtr(0,160,1),MGenericPtr(0,160,Bank(1),40)
  73. Use BitMap 0 : Line 319-8,0,320-96+8,79,0
  74. Use BitMap 1 : Line 319-8,0,320-96+8,79,0
  75.  
  76. ;Set up movement table
  77. .table
  78. MQueue 0,#Objects
  79. NEWTYPE.xy
  80.   x.w
  81.   y.w
  82. End NEWTYPE
  83. MParticleMode 0
  84. Dim xy.xy(#Objects)
  85. Dim direction.xy(#Objects)
  86. MAutoCookie On
  87. MUseBitmap 0
  88. For obj=1 To #Objects
  89.   MGetaShape obj,Rnd(1280-64),760+Rnd(200-64),64,64
  90.   xy(obj)\x=Rnd(1280-96)+16
  91.   xy(obj)\y=Rnd(960-96)+16
  92.   Repeat
  93.     direction(obj)\x=Rnd(12)-6
  94.   Until direction(obj)\x<>0
  95.   Repeat
  96.     direction(obj)\y=Rnd(12)-6
  97.   Until direction(obj)\y<>0
  98. Next obj
  99. MHandle 0,32,32
  100.  
  101. mag.q=12
  102. ShowBitMap 1-buf
  103. VWait
  104. ResetTimer
  105. .loop
  106. Repeat
  107.   MUseBitmap 0
  108.   MAddToParticles &xy(1)\x,#Objects,&direction(1)\x
  109.   MReboundParticles &xy(1)\x,#Objects,&direction(1)\x,48
  110.   For obj=1 To #Objects
  111.     MQBlit obj,xy(obj)\x,xy(obj)\y ; Stencil-cut blit and add to queue
  112.   Next obj
  113.  
  114.   MUseBitmap 1
  115.   player1x=SMouseX*mousemult
  116.   player1y=SMouseY*mousemult
  117.   player2x=(1280-238)-player1x
  118.   player2y=(960-160)-player1y
  119. ;player2x=player1x
  120. ;player2y=player1y
  121.   Mc2p 0,MBitmapPtr(player1x,player1y,0),Bank(buf)
  122.   Mc2p 1,MBitmapPtr(player1x,player1y+80,0),MGenericPtr(0,80,Bank(buf),40)
  123.   Mc2p 0,MBitmapPtr(player2x,player2y+80,0),MGenericPtr(96 LSR 3,160,Bank(buf),40)
  124.   Mc2p 1,MBitmapPtr(player2x+128,player2y,0),MGenericPtr(224 LSR 3,80,Bank(buf),40)
  125.   MScroll player1x+96+64,player1y+80,64,40,96+64,80,0,&leftrows1(0)
  126.   MScroll player1x+96,player1y+80+40,64,40,96,80+40,0,&leftrows2(0)
  127.   MScroll player2x+128-24,player2y,64,40,224-24,80,0,&rightrows2(0)
  128.   MScroll player2x+64,player2y+40,64,40,96+64,80+40,0,&rightrows1(0)
  129.   Mc2p 5,MBitmapPtr(96,80+40,1),MGenericPtr(96 LSR 3,80+40,Bank(buf),40)
  130.   Mc2p 5,MBitmapPtr(96+64,80,1),MGenericPtr((96+64) LSR 3,80,Bank(buf),40)
  131.   Mc2p 4,MBitmapPtr(player1x+96,player1y+80,0),MGenericPtr(96 LSR 3,80,Bank(buf),40)
  132.   Mc2p 4,MBitmapPtr(player2x+64,player2y+40,0),MGenericPtr(160 LSR 3,80+40,Bank(buf),40)
  133. ;MZoom player1x,player1y,mag,mag,0,160,96,80,False,0
  134. ;Mc2p 2,MBitmapPtr(0,160,1),MGenericPtr(0,160,Bank(buf),40)
  135.   its+1
  136.   ShowBitMap buf
  137. ;  VWait
  138.   buf=1-buf
  139.   If Joyb(0)=1 Then mag-0.1
  140.   If Joyb(0)=2 Then mag+0.1
  141.   MUnQueue 0,2
  142. Until Joyb(0)=3
  143.  
  144. ;Report
  145. .report
  146. t=Timer
  147. t=Max(t,1)
  148. its=Max(its,1)
  149. a.q=50.0/(t/its)
  150. WBenchToFront_
  151. WbToScreen 1
  152. Window 2,16,16,300,40,0,"Test results",1,0
  153. WindowOutput 2
  154. NPrint a," frames per second"
  155. NPrint " "
  156. NPrint "Press mouse/joy button..."
  157. VWait 20
  158. Repeat
  159. Until Joyb(0)<>0 OR Joyb(1)<>0
  160. End
  161.  
  162.